import axios from '@/utils/axios';

export function roleList(params) {
  return axios({
    url: '/role/list',
    method: 'get',
    params
  });
}

// 角色添加

// 角色修改
export function roleUpdate(data) {
  return axios({
    url: '/role/update',
    method: 'post',
    data
  });
}

// 角色详情
export function roleDetail(params) {
  return axios({
    url: '/role/detail/' + params,
    method: 'get'
  });
}

// 角色添加
export function addOneRole(data) {
  return axios({
    url: '/role/add',
    method: 'post',
    data
  });
}

// 删除单个角色
export function deleteOneRole(params) {
  return axios({
    url: '/role/delete/' + params,
    method: 'get'
  });
}

// 获取所有角色信息
export function getAllRoles() {
  return axios({
    url: '/role/all',
    method: 'get'
  });
}

// 修改角色对应权限
export function rolePermissionUpdate(data) {
  return axios({
    url: '/role/updateRolePermission/'+data.roleId,
    method: 'post',
    data: data.permissionIds
  });
}
